<?php

Route::group(['namespace' => 'Admin', 'prefix' => 'admin'], function () {
    Route::get('login', 'LoginController@showLoginForm')->name('admin.loginForm');
    Route::post('login', 'LoginController@login')->name('admin.login');
    Route::get('logout', 'LoginController@logout')->name('admin.logout');

});

Route::group(['namespace' => 'Admin', 'prefix' => 'admin', 'middleware' => 'auth'], function () {
    //后台布局
    Route::get('/layout', 'IndexController@layout')->name('admin.layout');

    Route::get('users', 'UserController@index')->name('admin.users');
    Route::get('users/create', 'UserController@create')->name('admin.users.create');
    Route::get('users/edit/{id}', 'UserController@edit')->name('admin.users.edit');
    Route::post('users/store', 'UserController@store')->name('admin.users.store');
    Route::put('users/update/{user}', 'UserController@update')->name('admin.users.update');
    Route::delete('destroy/{id}', 'UserController@destroy')->name('admin.users.destroy');

    Route::group(['prefix' => 'member'], function () {
        Route::get('/', 'MemberController@index')->name('admin.member');
    });

    Route::group(['prefix' => 'levels'], function () {
        Route::get('/', 'LevelController@index')->name('admin.levels');
        Route::get('create', 'LevelController@create')->name('admin.levels.create');
        Route::get('edit/{id}', 'LevelController@edit')->name('admin.levels.edit');
        Route::post('store', 'LevelController@store')->name('admin.levels.store');
        Route::put('update/{id}', 'LevelController@update')->name('admin.levels.update');
        Route::delete('destroy/{id}', 'LevelController@destroy')->name('admin.levels.destroy');
    });


    Route::group(['prefix' => 'goods'], function () {
        Route::get('/', 'ProductController@index')->name('admin.goods');
        Route::get('create', 'ProductController@create')->name('admin.goods.create');
        Route::get('edit/{id}', 'ProductController@edit')->name('admin.goods.edit');
        Route::post('create', 'ProductController@store')->name('admin.goods.store');
        Route::put('update/{id}', 'ProductController@update')->name('admin.goods.update');
        Route::delete('destroy/{id}', 'ProductController@destroy')->name('admin.goods.destroy');
    });

    Route::group(['prefix' => 'message'], function () {
        Route::get('/', 'MessageController@index')->name('admin.message');
        Route::get('create', 'MessageController@create')->name('admin.message.create');
        Route::get('edit/{id}', 'MessageController@edit')->name('admin.message.edit');
        Route::post('create', 'MessageController@store')->name('admin.message.store');
        Route::put('update/{id}', 'MessageController@update')->name('admin.message.update');
        Route::delete('destroy/{id}', 'MessageController@destroy')->name('admin.message.destroy');
    });

    Route::group(['prefix' => 'order'], function () {
        Route::get('/', 'OrderController@index')->name('admin.order');
        Route::get('create', 'OrderController@create')->name('admin.order.create');
        Route::get('edit/{id}', 'OrderController@edit')->name('admin.order.edit');
        Route::post('create', 'OrderController@store')->name('admin.order.store');
        Route::delete('destroy/{id}', 'OrderController@destroy')->name('admin.order.destroy');
        Route::put('update/{id}', 'OrderController@update')->name('admin.order.update');
    });

    Route::group(['prefix' => 'vpn'], function () {
        Route::get('/', 'VpnController@index')->name('admin.vpn');
        Route::get('create', 'VpnController@create')->name('admin.vpn.create');
        Route::get('edit/{id}', 'VpnController@edit')->name('admin.vpn.edit');
        Route::post('create', 'VpnController@store')->name('admin.vpn.store');
        Route::delete('destroy/{id}', 'VpnController@destroy')->name('admin.vpn.destroy');
        Route::put('update/{id}', 'VpnController@update')->name('admin.vpn.update');
    });


    Route::group(['prefix' => 'system'], function () {
        Route::get('/', 'ConfigController@open')->name('admin.open');
        Route::post('/', 'ConfigController@store')->name('admin.system.store');
    });


});
